package com.zhaoguang.car.controller.shopmanager;


import com.zhaoguang.car.common.RespBean;
import com.zhaoguang.car.entity.ShopInfo;
import com.zhaoguang.car.service.ShopInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/shop")
public class ShopInfoController {

    @Autowired
    ShopInfoService shopInfoService;

    @RequestMapping("/updateShopInfo")
    public RespBean updateShopInfo(ShopInfo shop) {
        int result = shopInfoService.updateShopInfo(shop);
        if (result > 0) {
            return RespBean.success("修改信息成功");
        }
        return RespBean.success("修改信息失败");
    }

    @RequestMapping("/findShopInfo")
    public RespBean findShopInfo(int shopId) {
        ShopInfo shop = shopInfoService.findShopInfo(shopId);
        if (shop != null) {
            return RespBean.success("查询成功", shop);
        }
        return RespBean.success("查询失败");
    }
}
